package web.controller.common;

import common.consts.ContentType;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import service.LogoutService;
import service.ServiceResponse;
import web.Routes;
import web.controller.Base;

/**
 * Created by Administrator on 2015/7/2.
 */

@RestController
@RequestMapping(Routes.Common.LOGOUT)
public class Logout extends Base {

    @Autowired
    private LogoutService logoutService;

    @RequestMapping(method = RequestMethod.GET, produces = ContentType.JSON)
    public ServiceResponse logout() {
        long userid = getUserIdFromAuthHeader();
        return logoutService.logout(userid);
    }
}
